/*
 * Category.cpp
 *
 *  Created on: Nov 16, 2013
 *      Author: SG0214746
 */

#include "Category.h"

Category::Category() : id(0) {}

Category::~Category() {}

Category::Category(BigInt id, const String& name, const String& description) : id(id), name(name), description(description) {}

Category::Category(const Category& other) {
	id = other.id;
	name = other.name;
	description = other.description;
}

Category& Category::operator =(const Category& other) {
	id = other.id;
	name = other.name;
	description = other.description;
	return *this;
}

BigInt Category::size() const {
	return 2 + sizeof(BigInt) + name.length() + description.length();
}

void Category::serialize(ISerializer& serializer) const {
	serializer.serializeUnsignedLongInt(id);
	serializer.serializeString(name);
	serializer.serializeString(description);
}

void Category::unserialize(IUnserializer& unserializer) {
	id = unserializer.unserializeUnsignedLongInt();
	name = unserializer.unserializeString();
	description = unserializer.unserializeString();
}
